﻿/*
=======================================================
    DepartmentUser【部门用户】
=======================================================
*/

namespace Services
{
    public interface IDepartmentUserRepository : IRepository<DepartmentUser>
    {
        int GetCountByDepartment(int departmentID);
    }


    public class DepartmentUserRepository : BaseRepository<DepartmentUser>, IDepartmentUserRepository
    {
        public DepartmentUserRepository(ISqlSugarClient dB, ICurrentUser currentUser, IQuery<DepartmentUser> query)
            : base(dB, currentUser, query)
        {
        }

        #region GetCountByDepartment
        public int GetCountByDepartment(int departmentID)
        {
            return _query.GetQueryable().Where(x => x.DepartmentID == departmentID).Count();
        } 
        #endregion
    }
}
